package com.awa.usercenter.controller;
import com.awa.usercenter.common.BaseResponse;
import com.awa.usercenter.common.Code;
import com.awa.usercenter.common.utils.ResultUtils;
import com.awa.usercenter.model.domain.CompanyAuth;
import com.awa.usercenter.service.CompanyAuthService;
import com.awa.usercenter.service.UserService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/company")
@Tag(name = "公司审批")
public class CompanyAuthController {

    @Resource
    private CompanyAuthService companyAuthService;
    @PostMapping("/authmsg")
    @Parameter(name="pageNum",description = "当前页码",required = true)
    @Parameter(name="pageSize",description = "每页显示的数据条数",required = true)
    @Operation(summary = "待审核公司表单")
    private BaseResponse authmsg(@RequestParam("pageNum") Long pageNum, @RequestParam("pageSize") Long pageSize){
        Page<CompanyAuth> page = companyAuthService.page(new Page<>(pageNum, pageSize));
        return ResultUtils.success(page);
    }
    @PostMapping("/accept")
    @Operation(summary = "公司审批接口(单个)")
    private BaseResponse accept(@RequestParam("auth_id") long auth_id)
    {
        if (companyAuthService.accept(auth_id)) {
            return ResultUtils.success(Code.SUCCESS);
        }
        return ResultUtils.error(Code.SYSTEM_ERROR);
    }

}
